import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './index.less';

const Index = ({ department, level, name, inServiceStatus, disabled, className, ...rest }) => (
    <div
        className={cn('personDiv', className, styles.person, {
            [styles.personSm]: level === 3,
            [styles.personLg]: level === 1,
            personDivDisabled: disabled
        })}
        {...rest}
    >
        <div title={`${department}(${name})`} className={styles.realName}>
            <span className={styles.departmentName}>{department}</span>
            <span className={styles.personName}>({name}{inServiceStatus === '兼任' && `-${inServiceStatus}`})</span>
        </div>
    </div>
);

Index.propTypes = {
    // 部门名称
    department: PropTypes.string,
    // 姓名
    name: PropTypes.string,
    // 级别
    level: PropTypes.oneOf([1, 2, 3]),
    // 是否禁用
    disabled: PropTypes.bool
};
Index.defaultProps = {
    department: '',
    name: '',
    level: 2,
    disabled: false
};

export default Index;
